package Noyau;

public class Garage extends CheminChariot
{	
    public void CreerChariot()
    {
    	Chariot nouveauChariot = new Chariot();
    	nouveauChariot.setVitesse(0.1);
    	nouveauChariot.setParent(this);
    	this.chariots.add(nouveauChariot);
    }
    
    @Override
    public boolean PeutAjouterChariot(Chariot chariot)
    {
    	return true;
    }

	@Override
	public boolean AjouterChariot(Chariot chariot) {
		//No maximum size
		chariot.setParent(this);
		this.chariots.add(chariot);
		return true;
	}

	@Override
	public void TickHorloge() 
	{
		if (this.chariots.size() == 0)
		{
			return;
		}
		
		Chariot firstChariot = this.chariots.get(0);
		
		if (this.sorties.size() == 0)
		{
			return;
		}
		
		InterfaceChariot firstSortie = this.sorties.get(0);
		
		if (!firstSortie.AjouterChariot(firstChariot))
		{
			return;
		}
		
		this.chariots.remove(firstChariot);
	}
	
	@Override
	public int getZBuffer()
	{
		return 10;
	}
}
